

"Going It Alone? A Structural Analysis of Coalition Formation in Elections"
Author:  Sergio Montero
Journal of Politics
Replication Package README


Software requirements: results in this replication package were generated using Matlab R2023a and Knitro 13.2.0.


One primary script generates everything required to reproduce all results, tables, and figures in the paper and Online Appendix.  Launch Matlab, set the root folder of the replication package as the working directory, and run the script "replicate_results.m."  Numerical results are printed to the command window, and figures are saved in the "figures" subfolder.  Parts of the replication require Matlab's "Parallel Computing Toolbox."

Results in this replication package were generated on January 11, 2023---see "matlab_log.txt."


********************
      CONTENTS
********************

1. CODEBOOK

	codebook.pdf: description of all variables in the raw data files as well as their sources.

2. DATA FILES

	1.1 /raw_data/district_characteristics.csv: observed characteristics of Mexican electoral districts (see codebook).
	1.2 /raw_data/election_results_2009.csv: 2009 Chamber of Deputies election results (see codebook).
	1.3 /raw_data/election_results_2012.csv: 2012 Chamber of Deputies election results (see codebook).
	1.4 /raw_data/campaign_spending_2009.csv: 2009 Chamber of Deputies campaign expenditures (see codebook).
	1.5 /raw_data/campaign_spending_2012.csv: 2012 Chamber of Deputies campaign expenditures (see codebook).
	1.6 /raw_data/shapefiles.mat: Mexican electoral district shapefiles (see codebook).
	1.7 /raw_data/2003FPTP.xlsx: 2003 Chamber of Deputies first-past-the-post candidates (see codebook).
	1.8 /raw_data/2003PR.xlsx: 2003 Chamber of Deputies proportional-representation candidates (see codebook).
	1.9 /raw_data/2006FPTP.xlsx: 2006 Chamber of Deputies first-past-the-post candidates (see codebook).
	1.10 /raw_data/2006PR.xlsx: 2006 Chamber of Deputies proportional-representation candidates (see codebook).
	1.11 /raw_data/2006FPTPsenate.xlsx: 2006 Senate first-past-the-post candidates (see codebook).
	1.12 /raw_data/2006PRsenate.xlsx: 2006 Senate proportional-representation candidates (see codebook).
	1.13 /raw_data/2009FPTP.xlsx: 2009 Chamber of Deputies first-past-the-post candidates (see codebook).
	1.14 /raw_data/2009PR.xlsx: 2009 Chamber of Deputies proportional-representation candidates (see codebook).
	1.15 /raw_data/2012FPTP.xlsx: 2012 Chamber of Deputies first-past-the-post candidates (see codebook).
	1.16 /raw_data/2012PR.xlsx: 2012 Chamber of Deputies proportional-representation candidates (see codebook).	
		
3. MATLAB SCRIPTS AND AUXILIARY FILES (the role of each file is explained in replicate_results.m and subsequent scripts) 

	3.1 replicate_results.m: 

	generates all results by calling on the following secondary scripts: /matlab/maps.m, /matlab/descriptive.m, /matlab/voting_stage.m, /matlab/spending_plots.m, /matlab/campaign_stage.m, /matlab/coalition_stage_p1.m, /matlab/coalition_stage.m, /matlab/coalition_stage_partial_id.m, /matlab/counterfactuals.m, /matlab/robustness/governors/voting_stage_govs.m, /matlab/robustness/governors/coalition_stage_govs.m, /matlab/robustness/dropOutliers/voting_stage_dropOutliers.m, /matlab/robustness/dropOutliers/coalition_stage_dropOutliers.m, /matlab/robustness/IVs/voting_stage_IVs.m;

	as well as the following functions and Knitro option files called by and explained in the scripts: /matlab/BRall.m, /matlab/EQ_bounds.m, /matlab/GH_Instr.m, /matlab/grad_cfs_moments.m, /matlab/grad_cs_moments.m, /matlab/HessL.m, /matlab/HessLL_cfs.m, /matlab/HessQ_cfs.m, /matlab/knitro.opt, /matlab/knitro0.opt, /matlab/knitro2.opt, /matlab/LL_cfs.m, /matlab/LogShares.m, /matlab/neighb.m, /matlab/nwspgr.m, /matlab/Payoffs.m, /matlab/print_results.m, /matlab/print_results_gamma.m, /matlab/print_results_theta.m, /matlab/Q_BLP.m, /matlab/Q_cfs.m, /matlab/Q_cs.m, /matlab/Shares.m, /matlab/surplus0.m, /matlab/surplus1.m, /matlab/surplus2.m, /matlab/surplus_2S.m, /matlab/xi_BLP.m, /matlab/robustness/governors/GH_Instr.m, /matlab/robustness/governors/grad_cfs_moments.m, /matlab/robustness/governors/HessL.m, /matlab/robustness/governors/HessLL_cfs.m, /matlab/robustness/governors/knitro.opt, /matlab/robustness/governors/LL_cfs.m, /matlab/robustness/governors/nwspgr.m, /matlab/robustness/governors/print_results_govs.m, /matlab/robustness/governors/print_results_theta_govs.m, /matlab/robustness/governors/Q_BLP.m, /matlab/robustness/governors/Shares.m, /matlab/robustness/governors/xi_BLP.m, /matlab/robustness/dropOutliers/GH_Instr.m, /matlab/robustness/dropOutliers/grad_cfs_moments.m, /matlab/robustness/dropOutliers/HessL.m, /matlab/robustness/dropOutliers/HessLL_cfs.m, /matlab/robustness/dropOutliers/knitro.opt, /matlab/robustness/dropOutliers/nwspgr.m, /matlab/robustness/dropOutliers/print_results.m, /matlab/robustness/dropOutliers/print_results_theta.m, /matlab/robustness/dropOutliers/Q_BLP.m, /matlab/robustness/dropOutliers/Q_cfs.m, /matlab/robustness/dropOutliers/Shares.m, /matlab/robustness/dropOutliers/xi_BLP.m, /matlab/robustness/IVs/GH_Instr.m, /matlab/robustness/IVs/HessL.m, /matlab/robustness/IVs/knitro.opt, /matlab/robustness/IVs/neighb.m, /matlab/robustness/IVs/nwspgr.m, /matlab/robustness/IVs/print_results.m, /matlab/robustness/IVs/Q_BLP.m, /matlab/robustness/IVs/Shares.m, /matlab/robustness/IVs/xi_BLP.m.

4. MATLAB INTERMEDIATE DATA FILES (produced by and described in the Matlab scripts above) 

	/matlab/voting_stage.mat, /matlab/campaign_stage.mat, /Matlab/coalition_stage.mat, /matlab/coalition_stage_p1.mat, /matlab/coalition_stage_partial_id.mat, /matlab/counterfactuals.mat, /matlab/robustness/governors/voting_stage_govs.mat, /matlab/robustness/governors/coalition_stage_govs.mat, /matlab/robustness/dropOutliers/voting_stage_dropOutliers.mat, /matlab/robustness/dropOutliers/coalition_stage_dropOutliers.mat, /matlab/robustness/IVs/voting_stage_IVs.mat.

5. FIGURES (produced by and described in the Matlab scripts above)

	/figures/fig1.png, /figures/figA1.png, /figures/figA2a.png, /figures/figA2b.png, /figures/figA2c.png, /figures/figA3a.png, /figures/figA3b.png, /figures/figA3c.png, /figures/figA3d.png, /figures/figA3e.png, /figures/figA3f.png, /figures/figA4a.png, /figures/figA4b.png, /figures/figA4c.png, /figures/figA4d.png, /figures/figA4e.png, /figures/figA4f.png.



